<template>
  <el-form ref="qmGenForm" :model="model" :rules="rules" :disabled="disabled" label-width="80px">
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="职位名称" prop="positionName">
          <el-input v-model="model.positionName" placeholder="请输入职位名称" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="职位分类" prop="positionCategory">
          <el-select v-model="model.positionCategory">
            <el-option
              v-for="item in controlData.positionCategory"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="工作地点" prop="workPlace">
          <el-select v-model="model.workPlace">
            <el-option
              v-for="item in controlData.workPlace"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="工作性质" prop="workNature">
          <el-select v-model="model.workNature" multiple>
            <el-option
              v-for="item in controlData.workNature"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="职位待遇" prop="positionTreatment">
          <el-select v-model="model.positionTreatment" multiple>
            <el-option
              v-for="item in controlData.positionTreatment"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="经验要求" prop="experience">
          <el-input v-model="model.experience" placeholder="请输入内容" />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="招聘薪酬">
          <el-input v-model="model.emolument" placeholder="请输入内容" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="发布人" prop="publisher">
          <el-input v-model="model.publisher" placeholder="请输入发布人" disabled />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="发布时间" prop="pubdate">
          <el-input v-model="model.pubdate" disabled />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="所属部门" prop="departmentId">
          <el-select v-model="model.departmentId" multiple placeholder="请选择部门">
            <el-option
              v-for="item in  controlData.deptTree"
              :key="item.id"
              :label="item.text"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="24">
        <el-form-item label="链接地址">
          <el-input v-model="model.linkAddress" placeholder="请输入内容" />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="24">
        <el-form-item label="职位责任">
          <el-input v-model="model.duty" type="textarea" :rows="5" placeholder="请输入内容" />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col>
        <el-form-item label="职位要求" prop="requirement">
          <el-input v-model="model.requirement" type="textarea" :rows="5" placeholder="请输入内容" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="是否启用" prop="isEnabled">
          <el-radio v-model="model.isEnabled" :label="true">是</el-radio>
          <el-radio v-model="model.isEnabled" :label="false">否</el-radio>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

<script>
export default {
  props: {
    models: Object,
    model: Object,
    disabled: Boolean,
    controlData: Object
  },
  data() {
    return {
      // 表单校验
      rules: {
        positionName: [
          {
            required: true,
            message: "职位名称不能为空",
            trigger: "blur"
          }
        ],
        positionCategory: [
          {
            required: true,
            message: "职位分类不能为空",
            trigger: "blur"
          }
        ],
        workPlace: [
          {
            required: true,
            message: "工作地点不能为空",
            trigger: "blur"
          }
        ],
        workNature: [
          {
            required: true,
            message: "工作性质(可多选)不能为空",
            trigger: "blur"
          }
        ],
        positionTreatment: [
          {
            required: true,
            message: "职位待遇(可多选)不能为空",
            trigger: "blur"
          }
        ],
        experience: [
          {
            required: true,
            message: "经验要求不能为空",
            trigger: "blur"
          }
        ],
        publisher: [
          {
            required: true,
            message: "发布人不能为空",
            trigger: "blur"
          }
        ],
        pubdate: [
          {
            required: true,
            message: "发布时间不能为空",
            trigger: "blur"
          }
        ],
        requirement: [
          {
            required: true,
            message: "职位要求不能为空",
            trigger: "blur"
          }
        ],
        isEnabled: [
          {
            required: true,
            message: "是否启用不能为空",
            trigger: "blur"
          }
        ],
        departmentId: [
          {
            required: true,
            message: "所属部门名称不能为空",
            trigger: "blur"
          }
        ]
      }
    };
  },
  methods: {}
};
</script>

<style scoped lang="scss">
</style>
